package com.ihr360.cnb.module.insurance.service.feign;

import com.ihr360.cnb.module.insurance.service.feign.fallback.InsuranceMemberPlanServiceFallback;
import com.ihr360.commons.vo.PageData;
import com.ihr360.excel.entity.ExportParams;
import com.ihr360.insurance.entity.request.MemberPlanReq;
import com.ihr360.insurance.entity.request.StaffIdRequest;
import com.ihr360.insurance.entity.response.LedgerResponse;
import com.ihr360.insurance.entity.vo.MemberPlanVo;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @author Stone.Shi
 * @description 社保公积金增减员
 * @date 2018-05-24 17:13:28.
 */
@FeignClient(name = "ihr360-insurance-provider", fallback = InsuranceMemberPlanServiceFallback.class)
public interface InsuranceMemberPlanService {

    /**
     * 获取导出的增员数据
     *
     * @param companyId
     * @param userId
     * @param req
     * @return
     */
    @PostMapping(value = "/increaseMemberPlans/member/getExportData", produces = MediaType.APPLICATION_JSON_VALUE)
    ExportParams<List<Object>> getExportExcelDataIncrease(@RequestParam(value = "companyId") String companyId,
                                                          @RequestParam(value = "userId") String userId,
                                                          @RequestBody MemberPlanReq req);

    /**
     * 获取增员数据
     *
     * @param companyId
     * @param userId
     * @param req
     * @return
     */
    @PostMapping(value = "/increaseMemberPlans/member/list", produces = MediaType.APPLICATION_JSON_VALUE)
    PageData<MemberPlanVo> getIncreaseMemberList(@RequestParam(value = "companyId") String companyId,
                                                 @RequestParam(value = "userId") String userId,
                                                 @RequestBody MemberPlanReq req);

    /**
     * 关账保存增员数据
     *
     * @param ledgerSummaryId
     * @param staffIdRequest
     */
    @PostMapping(value = "/increaseMemberPlans/member/saveRecords", produces = MediaType.APPLICATION_JSON_VALUE)
    void saveIncreaseMembers(@RequestParam(value = "ledgerSummaryId") Long ledgerSummaryId,
                             @RequestBody StaffIdRequest staffIdRequest);

    /**
     * 将增员的员工加入台账
     *
     * @param companyId
     * @param userId
     * @param year
     * @param month
     * @param vo
     * @return
     */
    @RequestMapping(value = "/increaseMemberPlans/member/add", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    LedgerResponse addIncreaseMember(@RequestParam(value = "companyId") String companyId,
                                     @RequestParam(value = "userId") String userId,
                                     @RequestParam(value = "year") Integer year,
                                     @RequestParam(value = "month") Integer month,
                                     @RequestBody MemberPlanVo vo);

    /**
     * 将增员的员工从台账移除
     *
     * @param companyId
     * @param userId
     * @param year
     * @param month
     * @param vo
     * @return
     */
    @RequestMapping(value = "/increaseMemberPlans/member/remove", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    void removeIncreaseMember(@RequestParam(value = "companyId") String companyId,
                              @RequestParam(value = "userId") String userId,
                              @RequestParam(value = "year") Integer year,
                              @RequestParam(value = "month") Integer month,
                              @RequestBody MemberPlanVo vo);

    /**
     * 获取导出的减员数据
     *
     * @param companyId
     * @param userId
     * @param req
     * @return
     */
    @PostMapping(value = "/decreaseMemberPlans/member/getExportData", produces = MediaType.APPLICATION_JSON_VALUE)
    ExportParams<List<Object>> getExportExcelDataDecrease(@RequestParam(value = "companyId") String companyId,
                                                          @RequestParam(value = "userId") String userId,
                                                          @RequestBody MemberPlanReq req);

    /**
     * 获取减员数据
     *
     * @param companyId
     * @param userId
     * @param req
     * @return
     */
    @PostMapping(value = "/decreaseMemberPlans/member/list", produces = MediaType.APPLICATION_JSON_VALUE)
    PageData<MemberPlanVo> getDecreaseMemberList(@RequestParam(value = "companyId") String companyId,
                                                 @RequestParam(value = "userId") String userId,
                                                 @RequestBody MemberPlanReq req);

    /**
     * 关账保存减员数据
     *
     * @param ledgerSummaryId
     * @param staffIdRequest
     */
    @PostMapping(value = "/decreaseMemberPlans/member/saveRecords", produces = MediaType.APPLICATION_JSON_VALUE)
    void saveDecreaseMembers(@RequestParam(value = "ledgerSummaryId") Long ledgerSummaryId,
                             @RequestBody StaffIdRequest staffIdRequest);

    /**
     * 将减员的员工加入台账
     *
     * @param companyId
     * @param userId
     * @param year
     * @param month
     * @param vo
     * @return
     */
    @RequestMapping(value = "/decreaseMemberPlans/member/add", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    LedgerResponse addDecreaseMember(@RequestParam(value = "companyId") String companyId,
                                     @RequestParam(value = "userId") String userId,
                                     @RequestParam(value = "year") Integer year,
                                     @RequestParam(value = "month") Integer month,
                                     @RequestBody MemberPlanVo vo);

    /**
     * 将减员的员工加入台账
     *
     * @param companyId
     * @param userId
     * @param year
     * @param month
     * @param vo
     * @return
     */
    @RequestMapping(value = "/decreaseMemberPlans/member/remove", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    void removeDecreaseMember(@RequestParam(value = "companyId") String companyId,
                              @RequestParam(value = "userId") String userId,
                              @RequestParam(value = "year") Integer year,
                              @RequestParam(value = "month") Integer month,
                              @RequestBody MemberPlanVo vo);

}
